package com.app.base.adapter.holder;


import android.support.v7.widget.RecyclerView;
import android.view.View;

public abstract  class BaseHolder<T> extends RecyclerView.ViewHolder {
	
	protected View mRootView;
	protected int mPosition;
	protected T mItem;
	protected Object headData;
	public BaseHolder(View view) {
		super(view);
		this.mRootView = view;
		initView();
	}

	public View getRootView() {
		return mRootView;
	}

	public void setHeaderData(Object headData){
		this.headData = headData;
		refreshView();
	}
	public void setData(T mItem,int position) {
		this.mItem = mItem;
		mPosition = position;
		refreshView();
	}

	public T getData() {
		return this.mItem;
	}

	/** 子类必须覆盖用于实现UI初始化 */
	protected abstract void initView();

	/** 子类必须覆盖用于实现UI刷新 */
	protected abstract void refreshView();

	/** 用于回收 */
	public void recycle() {

	}
}
